﻿package Classes.Enemies.Emplacements
{
	import flash.display.*;
	import flash.geom.*;
	
	import Classes.Weapons.*;
	import Classes.Elements.*;
	import Classes.Weapons.Bullets.*;	
	import Classes.Weapons.Rockets.*;	
	import Classes.Enemies.*;
	import Classes.Utils.*;
	
	public class Rocketdrome extends Emplacement{		
		public function Rocketdrome(){			
			pointable = true;
			aFirePoints = [[-4,-20],[4,-20],[0,-15],[-2,-10],[2,-10]];
			omega = 3;			
			life = 100;
			hp = 100;
			execution = 30;
			weaponType = WeaponType.Bazzoka;
			score = UnitType.Rocketdrome.score;
		}
		override public function fire():void{			
			var num:int = inc % weaponType.interval;
			var pnum:int = aFirePoints.length
			if(num < 2*pnum){
				var bazzoka:Bazzoka = new Bazzoka();
				var gpos:Array = getGolbalFirePoints();
				bazzoka.aTargets = this.aTargets;
				bazzoka.rotation = this.rotation;
				bazzoka.angle = -this.rotation;
				bazzoka.sender = this;
				bazzoka.x = gpos[num%pnum][0];
				bazzoka.y = gpos[num%pnum][1];
				bulletLayer.addChild(bazzoka);				
				gpos = null;
			}			
		}
		override protected function move():void{
			inc++;
			super.move();
			if(pointable)
				Moving.pointTo(this,aTargets[0],omega);
			if(fireable)
				fire();
		}
	}
}